package com.mango.httpforward.web.holder;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 配置缓存
 */
public class ForwardHolder {

    private static final Map<String, Map<String, String>> FORWARD_KEYVALUE_MAP = new ConcurrentHashMap<>();

    public static Map<String, String> getForwardMap(String key) {
        return FORWARD_KEYVALUE_MAP.get(key);
    }

    public static void setForwardMap(String key, Map<String, String> map) {
        FORWARD_KEYVALUE_MAP.put(key, map);
    }

    public static String getForwardUrl(String key, String subKey) {
        if (FORWARD_KEYVALUE_MAP.get(key) == null) {
            return null;
        }
        return FORWARD_KEYVALUE_MAP.get(key).get(subKey);
    }

}
